home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 10 / The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso / PC_SIGCD / 13 / 2 / DISK1324.ZIP / EXTLIB.DOC < prev    next >
Text File  |  1988-06-01  |  103KB  |  4,591 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.                                EXTENDED LIBRARY
  18.  
  19.                                   Version 1.0
  20.  
  21.  
  22.  
  23.  
  24.                                Reference Manual
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.                                 Distributed By
  42.  
  43.                     Maine Data and Financial Systems, Inc.
  44.                                 HCR 79 Box 103
  45.                                Orland, ME 04472
  46.  
  47.                                 (207) 469-7027
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.                      Copyright (c) 1988 By Mark D. Goodwin
  61.                               All Rights Reserved
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                                                      License Agreement
  68.  
  69.                                License Agreement
  70.  
  71.           The Extended Library is protected by United States Copyright
  72.           Law and International Treaty  provisions.    All  rights are
  73.           reserved.    Non-registered  users  of  Extended Library are
  74.           licensed only to use the program  on a  trial basis  for the
  75.           sole purpose  of determining  whether or  not it meets their
  76.           requirements.  All other use requires registration.
  77.  
  78.           Any other use of  non-registered copies  of Extended Library
  79.           by    any    person,   business,   corporation,   government
  80.           organization, or any other entity is  strictly forbidden and
  81.           is a violation of this license agreement.
  82.  
  83.           Registration permits  a user license to use Extended Library
  84.           on a single computer.
  85.  
  86.           All users are granted a  limited  license  to  copy Extended
  87.           Library  for  the  trial  use  of others, with the following
  88.           additional conditions:
  89.  
  90.                Extended   Library   must   be    distributed   in
  91.                unmodified,   complete    form,   including   this
  92.                Reference Manual and License Agreement.
  93.  
  94.                Extended  Library   may  not   be  distributed  in
  95.                conjunction   with   any  other  product,  without
  96.                permission of Maine  Data  and  Financial Systems,
  97.                Inc.
  98.  
  99.                No  fee,  other  than  a bonafide disk duplicating
  100.                fee, not  to  exceed  $6.00,  may  be  charged for
  101.                Extended Library.
  102.  
  103.           Maine Data and Financial Systems, Inc. grants, to registered
  104.           owners  only,  a  royalty-free   right   to   reproduce  and
  105.           distribute   the   runtime   routines   provided   they  are
  106.           distributed only  in  conjunction  with  and  as  part  of a
  107.           software product.
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.                                                                      i
  121.  
  122.  
  123.  
  124.  
  125.  
  126.                                                               Warranty
  127.  
  128.                                    Warranty
  129.  
  130.           Maine Data  and Financial Systems, Inc. makes no warranty of
  131.           any kind, express or implied, including  without limitation,
  132.           any  warranties  of  merchantability  and/or  fitness  for a
  133.           particular purpose.  Maine Data and  Financial Systems, Inc.
  134.           shall not  be held  liable for  any damages, whether direct,
  135.           indirect, special or consequential arising from a failure of
  136.           this program  to operate  in the manner desired by the user.
  137.           Maine Data and Financial Systems,  Inc.  shall  not  be held
  138.           liable  for  any  damage  to  data  or property which may be
  139.           caused directly or indirectly by the use of this program.
  140.  
  141.           In no event will Maine Data  and Financial  Systems, Inc. be
  142.           held liable  for any damages, including (but not limited to)
  143.           any  lost  profits,  lost  savings  or  other  incidental or
  144.           consequential damages arising out of the use or inability to
  145.           use this program, or for any claim by any other party.
  146.  
  147.           This warranty is governed by the laws of the State of Maine.
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.                                                                     ii
  180.  
  181.  
  182.  
  183.  
  184.  
  185.                                                      Table of Contents
  186.  
  187.                                Table of Contents
  188.  
  189.           Introduction . . . . . . . . . . . . . . . . . . . . . .   1
  190.  
  191.           Libraries  . . . . . . . . . . . . . . . . . . . . . . .   2
  192.  
  193.           Global Variables . . . . . . . . . . . . . . . . . . . .   3
  194.                cursorstart . . . . . . . . . . . . . . . . . . . .   3
  195.                cursorend . . . . . . . . . . . . . . . . . . . . .   3
  196.                _mbatt1 . . . . . . . . . . . . . . . . . . . . . .   3
  197.                _mbatt2 . . . . . . . . . . . . . . . . . . . . . .   3
  198.                _mmatt1 . . . . . . . . . . . . . . . . . . . . . .   3
  199.                _mmatt2 . . . . . . . . . . . . . . . . . . . . . .   3
  200.                nonibm  . . . . . . . . . . . . . . . . . . . . . .   4
  201.                _pdatt1 . . . . . . . . . . . . . . . . . . . . . .   4
  202.                _pdatt2 . . . . . . . . . . . . . . . . . . . . . .   4
  203.                _pdatt3 . . . . . . . . . . . . . . . . . . . . . .   4
  204.                _puatt1 . . . . . . . . . . . . . . . . . . . . . .   4
  205.                _puatt2 . . . . . . . . . . . . . . . . . . . . . .   4
  206.                _puatt3 . . . . . . . . . . . . . . . . . . . . . .   4
  207.  
  208.           Standard Types . . . . . . . . . . . . . . . . . . . . .   5
  209.                boolean . . . . . . . . . . . . . . . . . . . . . .   5
  210.                MENU  . . . . . . . . . . . . . . . . . . . . . . .   5
  211.                MENU_HEAD . . . . . . . . . . . . . . . . . . . . .   6
  212.  
  213.           Reference  . . . . . . . . . . . . . . . . . . . . . . .   7
  214.                clearone  . . . . . . . . . . . . . . . . . . . . .   8
  215.                clearscreen . . . . . . . . . . . . . . . . . . . .   9
  216.                close_window  . . . . . . . . . . . . . . . . . . .  10
  217.                cursoroff . . . . . . . . . . . . . . . . . . . . .  11
  218.                cursoron  . . . . . . . . . . . . . . . . . . . . .  11
  219.                display_error . . . . . . . . . . . . . . . . . . .  12
  220.                display_menu_bar  . . . . . . . . . . . . . . . . .  13
  221.                drawbox . . . . . . . . . . . . . . . . . . . . . .  15
  222.                draw_window . . . . . . . . . . . . . . . . . . . .  16
  223.                error_handler . . . . . . . . . . . . . . . . . . .  18
  224.                fillone . . . . . . . . . . . . . . . . . . . . . .  19
  225.                fillscreen  . . . . . . . . . . . . . . . . . . . .  20
  226.                fire  . . . . . . . . . . . . . . . . . . . . . . .  21
  227.                getcurpos . . . . . . . . . . . . . . . . . . . . .  23
  228.                horizontal_bar  . . . . . . . . . . . . . . . . . .  24
  229.                inputdollars  . . . . . . . . . . . . . . . . . . .  26
  230.                inputfields . . . . . . . . . . . . . . . . . . . .  27
  231.                inputnumber . . . . . . . . . . . . . . . . . . . .  29
  232.                inputstring . . . . . . . . . . . . . . . . . . . .  30
  233.                menu_bar  . . . . . . . . . . . . . . . . . . . . .  31
  234.                mini_menu . . . . . . . . . . . . . . . . . . . . .  33
  235.                open_window . . . . . . . . . . . . . . . . . . . .  35
  236.                popup . . . . . . . . . . . . . . . . . . . . . . .  37
  237.  
  238.                                                                    iii
  239.  
  240.  
  241.  
  242.  
  243.  
  244.                                                      Table of Contents
  245.  
  246.                printcenter . . . . . . . . . . . . . . . . . . . .  39
  247.                printdelimit  . . . . . . . . . . . . . . . . . . .  40
  248.                printfields . . . . . . . . . . . . . . . . . . . .  42
  249.                printheads  . . . . . . . . . . . . . . . . . . . .  44
  250.                printone  . . . . . . . . . . . . . . . . . . . . .  46
  251.                printstring . . . . . . . . . . . . . . . . . . . .  47
  252.                pulldown  . . . . . . . . . . . . . . . . . . . . .  48
  253.                pulldown_bar  . . . . . . . . . . . . . . . . . . .  52
  254.                restorescreen . . . . . . . . . . . . . . . . . . .  53
  255.                save_initial_video  . . . . . . . . . . . . . . . .  55
  256.                savescreen  . . . . . . . . . . . . . . . . . . . .  56
  257.                setattrib . . . . . . . . . . . . . . . . . . . . .  58
  258.                setcurpos . . . . . . . . . . . . . . . . . . . . .  59
  259.                setcursor . . . . . . . . . . . . . . . . . . . . .  60
  260.                setone  . . . . . . . . . . . . . . . . . . . . . .  61
  261.                settext80 . . . . . . . . . . . . . . . . . . . . .  62
  262.                stick . . . . . . . . . . . . . . . . . . . . . . .  63
  263.                vertical_bar  . . . . . . . . . . . . . . . . . . .  65
  264.                waitkey . . . . . . . . . . . . . . . . . . . . . .  67
  265.  
  266.           Appendix A - Using Extended Library With QuickC  . . . .  68
  267.                Constructing a Quick Library  . . . . . . . . . . .  68
  268.                The QuickC Windowing Environment  . . . . . . . . .  68
  269.  
  270.           Appendix B - Source Code Files . . . . . . . . . . . . .  70
  271.  
  272.           Appendix C - Registration  . . . . . . . . . . . . . . .  72
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.                                                                     iv
  298.  
  299.  
  300.  
  301.  
  302.  
  303.                                                           Introduction
  304.  
  305.                                  Introduction
  306.  
  307.           Extended Library  is  an  extensive  library  of  C run-time
  308.           routines that  allow easy  program implementation of many of
  309.           today's advanced programming techniques.   Some  of Extended
  310.           Library's  features  include  windows, pulldown menus, popup
  311.           menus, mini-menus, menu bars, horizontal and vertical scroll
  312.           bars, reading and writing directly to display memory without
  313.           interference,  formatted  display  input  routines, advanced
  314.           error  handling  functions,  and  a  wide  variety of cursor
  315.           control routines.
  316.  
  317.           The Extended Library routines  are written  in both assembly
  318.           language  and  C  and  can  be  used with both the Microsoft
  319.           QuickC and C 5.0 compilers.   The Extended  Library supports
  320.           the  small,   medium,  compact,  and  large  memory  models.
  321.           Furthermore, both  emulation and  math coprocessor libraries
  322.           are provided.
  323.  
  324.  
  325.  
  326.  
  327.           Microsoft  is   a  registered  trademark  and  QuickC  is  a
  328.           trademark of the Microsoft Corporation.
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.                                                                      1
  357.  
  358.  
  359.  
  360.  
  361.  
  362.                                                              Libraries
  363.  
  364.                                    Libraries
  365.  
  366.           Although the Extended Library  is  really  only  one  set of
  367.           library routines,  C's support  of the various memory models
  368.           and floating point emulation  (when necessary)  requires two
  369.           separate  versions  of  the  library  for each memory model.
  370.           Therefore, the Extended Library is provided in the following
  371.           eight versions:
  372.  
  373.           Memory Model        Emulator            Coprocessor
  374.  
  375.           Small               SEXTLIBE.LIB        SEXTLIB7.LIB
  376.           Medium              MEXTLIBE.LIB        MEXTLIB7.LIB
  377.           Compact             CEXTLIBE.LIB        CEXTLIB7.LIB
  378.           Large               LEXTLIBE.LIB        LEXTLIB7.LIB
  379.  
  380.           Only the  MEXTLIBE.LIB library  is provided on the shareware
  381.           distribution disk.  Because MEXTLIBE.LIB is  a medium memory
  382.           model  library,  its  routines  can  be used from within the
  383.           QuickC environment by using them as part of  a quick library
  384.           (see  Appendix  A  for  hints on producing a quick library).
  385.           Registration is required to obtain the  other seven versions
  386.           of the library.
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.                                                                      2
  416.  
  417.  
  418.  
  419.  
  420.  
  421.                                                       Global Variables
  422.  
  423.                                Global Variables
  424.  
  425.           The Extended  Library defines  a number  of variables in the
  426.           extlib.h file.   Through  proper use,  these variables allow
  427.           you  to  streamline  the  Extended  Library  functions for a
  428.           particular application.
  429.  
  430.  
  431.           cursorstart, cursorend
  432.  
  433.           int cursorstart;
  434.           int cursorend;
  435.  
  436.           The cursorstart  and  cursorend  variables  hold  the cursor
  437.           starting line  and the cursor ending line respectively.  The
  438.           cursor character can be  changed by  setting cursorstart and
  439.           cursorend  to  appropriate  values  and calling the cursoron
  440.           function.  Note that the same effect can  be accomplished by
  441.           simply calling the setcursor function.
  442.  
  443.  
  444.           _mbatt1, _mbatt2
  445.  
  446.           int _mbatt1;
  447.           int _mbatt2;
  448.  
  449.           The    _mbatt1    and    _mbatt2   variables   control   the
  450.           display_menu_bar    and    menu_bar    functions'    display
  451.           attributes.   _mbatt1 is the normal attribute (initially set
  452.           to 0x70).  _mbatt2 is the hotkey attribute (initially set to
  453.           0x7b).   The initial values have been selected for effective
  454.           displays on monochrome systems.    Therefore,  color monitor
  455.           users may wish to change these values to take full advantage
  456.           of their color system's capabilities.
  457.  
  458.  
  459.           _mmatt1, _mmatt2
  460.  
  461.           int _mmatt1;
  462.           int _mmatt2;
  463.  
  464.           The _mmatt1 and _mmatt2 variables control the display_error,
  465.           error_handler, and  mini_menu functions' display attributes.
  466.           _mmatt1 is the normal  attribute  (initially  set  to 0x70).
  467.           _mmatt2  is  the  hotkey  attribute (initially set to 0x7b).
  468.           The initial values have been selected for effective displays
  469.           on monochrome  systems.   Therefore, color monitor users may
  470.           wish to change these values to take full  advantage of their
  471.           color system's capabilities.
  472.  
  473.  
  474.                                                                      3
  475.  
  476.  
  477.  
  478.  
  479.  
  480.                                                       Global Variables
  481.  
  482.  
  483.           nonibm
  484.  
  485.           int nonibm;
  486.  
  487.           The nonibm  variable is  used to  eliminate snow  on IBM CGA
  488.           display adapters.   The  settext80  function  initially sets
  489.           nonibm to  a value  of 0 if a CGA adapter is present or to a
  490.           value of 1 if an MDA or EGA adapter is present.  If you have
  491.           a nonIBM  CGA, you  may want  to set nonibm to a value of 1.
  492.           This will speed up the Extended Library routines by allowing
  493.           the  video  routines  to  read and write directly to display
  494.           memory without waiting for the video retrace periods.
  495.  
  496.  
  497.           _pdatt1, _pdatt2, _pdatt3
  498.  
  499.           int _pdatt1;
  500.           int _pdatt2;
  501.           int _pdatt3;
  502.  
  503.           The _pdatt1,  _pdatt2,  and  _pdatt3  variables  control the
  504.           pulldown  and  pulldown_bar  functions'  display attributes.
  505.           _pdatt1 is the normal  attribute  (initially  set  to 0x70).
  506.           _pdatt2  is  the  hotkey  attribute (initially set to 0x7b).
  507.           _pdatt3 is the highlight  bar  attribute  (initially  set to
  508.           0x0c).   The initial values have been selected for effective
  509.           displays on monochrome systems.    Therefore,  color monitor
  510.           users may wish to change these values to take full advantage
  511.           of their color system's capabilities.
  512.  
  513.  
  514.  
  515.           _puatt1, _puatt2, _puatt3
  516.  
  517.           int puatt1;
  518.           int puatt2;
  519.           int puatt3;
  520.  
  521.           The _puatt1,  _puatt2,  and  _puatt3  variables  control the
  522.           popup function's  display attributes.  _puatt1 is the normal
  523.           attribute (initially set to  0x70).   _puatt2 is  the hotkey
  524.           attribute (initially set to 0x7b).  _puatt3 is the highlight
  525.           bar attribute (initially set to 0x0c).   The  initial values
  526.           have  been  selected  for  effective  displays on monochrome
  527.           systems.  Therefore, color monitor users may wish  to change
  528.           these values  to take full advantage of their color system's
  529.           capabilities.
  530.  
  531.  
  532.  
  533.                                                                      4
  534.  
  535.  
  536.  
  537.  
  538.  
  539.                                                         Standard Types
  540.  
  541.                                 Standard Types
  542.  
  543.           The Extended  Library  defines  (in  extlib.h)  a  number of
  544.           useful data types.
  545.  
  546.  
  547.           boolean
  548.  
  549.           typedef int boolean;
  550.  
  551.           The boolean  data type  is used to define logical variables.
  552.           To assist in the use of the boolean type, the  following two
  553.           manifest constants have been defined in extlib.h:
  554.  
  555.                Constant                 Value
  556.                TRUE                     1
  557.                FALSE                    0
  558.  
  559.  
  560.           MENU
  561.  
  562.           typedef struct {
  563.                char string[31];
  564.                int hotkey;
  565.                int (*function)();
  566.           } MENU;
  567.  
  568.           The MENU  structure is used to define menu selections in the
  569.           display_menu_bar, menu_bar, mini_menu, popup,  pulldown, and
  570.           pulldown_bar menu  routines.   The MENU structure is used as
  571.           follows:
  572.  
  573.                Type                     Description
  574.                string                   String    up     to    30
  575.                                         characters in length that
  576.                                         defines the  menu choice.
  577.                                         By  setting  string  to a
  578.                                         null string "", the popup
  579.                                         and   pulldown  functions
  580.                                         will display a horizontal
  581.                                         line in the menu display.
  582.                hotkey                   Position in string of the
  583.                                         menu    choice's   hotkey
  584.                                         character.
  585.                (*function)()            Function  to  execute  if
  586.                                         the   menu    choice   is
  587.                                         selected.
  588.  
  589.  
  590.  
  591.  
  592.                                                                      5
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                                         Standard Types
  599.  
  600.           MENU_HEAD
  601.  
  602.           typedef struct {
  603.                char heading[21];
  604.                int hotkey;
  605.                int number;
  606.                MENU *mptr;
  607.           } MENU_HEAD;
  608.  
  609.           The  MENU_HEAD  structure  is  used  to define the number of
  610.           menus for the  pulldown  and  pulldown_bar  functions.   The
  611.           MENU_HEAD structure is used as follows:
  612.  
  613.                Type                     Description
  614.                heading                  String     up    to    20
  615.                                         characters in length that
  616.                                         defines     the    menu's
  617.                                         heading.
  618.                hotkey                   Position  in  heading  of
  619.                                         the    menu's    pulldown
  620.                                         hotkey character.
  621.                number                   Number of  choices in the
  622.                                         pulldown menu.
  623.                mptr                     Pointer  to  an  array of
  624.                                         MENU    structures   that
  625.                                         defines    the   pulldown
  626.                                         menu.
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.                                                                      6
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                                              Reference
  658.  
  659.                                    Reference
  660.  
  661.           This section of the manual is  the reference  section.  Each
  662.           routine  in  the  Extended  Library  is  described  here  in
  663.           alphabetical order.
  664.  
  665.           Below the name  of  each  routine,  Summary  illustrates the
  666.           exact  syntax  model  for the function, Description outlines
  667.           the function's actual effects, Return Value  explains any of
  668.           the possible  return values  for the routine, See Also lists
  669.           any  similar  or  related   routines,   and   Example  helps
  670.           illustrate  how  the  routine  is  implemented  in an actual
  671.           program.
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.                                                                      7
  711.  
  712.  
  713.  
  714.  
  715.  
  716.                                                               clearone
  717.  
  718.           Summary
  719.  
  720.           #include <extlib.h>
  721.  
  722.           void clearone(row, col, attribute);
  723.           int row, col;                 Character position.
  724.           int attribute;                Character attribute.
  725.  
  726.  
  727.           Description
  728.  
  729.           The  clearone  routine  displays  a  space  at  the position
  730.           defined  by  (row,  col).    Additionally,  the  character's
  731.           attribute is set to attribute.
  732.  
  733.  
  734.           Return Value
  735.  
  736.           No value is returned.
  737.  
  738.  
  739.           Example
  740.  
  741.           #include <stdio.h>
  742.           #include <extlib.h>
  743.  
  744.           main()
  745.           {
  746.               save_initial_video();
  747.               printstring(1, 1, "This is a demo of clearone");
  748.               waitkey();
  749.               clearone(1, 1, 7);
  750.               waitkey();
  751.               exit(0);
  752.           }
  753.  
  754.           This program displays a message  and  erases  the  T  at the
  755.           start of the message.
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.                                                                      8
  770.  
  771.  
  772.  
  773.  
  774.  
  775.                                                            clearscreen
  776.  
  777.           Summary
  778.  
  779.           #include <extlib.h>
  780.  
  781.           void clearscreen(row1, col1, row2, col2, attribute);
  782.           int row1, col1;               Upper-left corner  of the text
  783.                                         window.
  784.           int row2, col2;               Lower-right corner of the text
  785.                                         window.
  786.           int attribute;                Display   attribute   for  the
  787.                                         window.
  788.  
  789.  
  790.           Description
  791.  
  792.           The clearscreen routine blanks an area of the screen defined
  793.           by the  points (row1, col1) and (row2, col2).  Additionally,
  794.           the attributes for the blanked  area  are  set  to attribute
  795.           and the  cursor position is set to the blanked area's upper-
  796.           left hand corner.
  797.  
  798.  
  799.           Return Value
  800.  
  801.           No value is returned.
  802.  
  803.  
  804.           Example
  805.  
  806.           #include <stdio.h>
  807.           #include <extlib.h>
  808.  
  809.           main()
  810.           {
  811.               settext80();
  812.               clearscreen(1, 1, 25, 80, 7);
  813.               printf("The screen is cleared!");
  814.               waitkey();
  815.               exit(0);
  816.           }
  817.  
  818.           This program clears the screen and  prints a  message in the
  819.           upper-right hand corner.
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.                                                                      9
  829.  
  830.  
  831.  
  832.  
  833.  
  834.                                                           close_window
  835.  
  836.           Summary
  837.  
  838.           #include <extlib.h>
  839.  
  840.           WINDOW *close_window(window);
  841.           WINDOW *window;               Pointer    to   a   previously
  842.                                         opened      text      window's
  843.                                         structure.
  844.  
  845.  
  846.           Description
  847.  
  848.           The close_window  routine closes  a previously opened window
  849.           by restoring  the former  screen contents  and releasing any
  850.           memory that was allocated during the opening of the window.
  851.  
  852.  
  853.           Return Value
  854.  
  855.           close_window returns a NULL pointer of type WINDOW.
  856.  
  857.  
  858.           See Also
  859.  
  860.           open_window
  861.  
  862.  
  863.           Example
  864.  
  865.           #include <stdio.h>
  866.           #include <extlib.h>
  867.  
  868.           main()
  869.           {
  870.               WINDOW *window;
  871.  
  872.               save_initial_video();
  873.               window = open_window(1, 20, 15, 50, _DRAW, 0x70,
  874.                   _SINGLE_LINE, 0x70);
  875.               waitkey();
  876.               window = close_window(window);
  877.               exit(0);
  878.           }
  879.  
  880.           This program  opens a text window at the coordinates (1, 20)
  881.           and (15, 50), draws the window by clearing  it, and  draws a
  882.           single  line  border  around  the  perimeter  of the window.
  883.           After waiting for a key to be pressed, the program continues
  884.           by closing the window.
  885.  
  886.  
  887.                                                                     10
  888.  
  889.  
  890.  
  891.  
  892.  
  893.                                                    cursoroff, cursoron
  894.  
  895.           Summary
  896.  
  897.           #include <extlib.h>
  898.  
  899.           void cursoroff(void);
  900.  
  901.           void cursoron(void);
  902.  
  903.  
  904.           Description
  905.  
  906.           The cursoroff  routine turns  the cursor  off.  The cursoron
  907.           routine turns the cursor on.
  908.  
  909.  
  910.           Return Value
  911.  
  912.           No value is returned.
  913.  
  914.  
  915.           Example
  916.  
  917.           #include <stdio.h>
  918.           #include <extlib.h>
  919.  
  920.           main()
  921.           {
  922.               settext80();
  923.               clearscreen(1, 1, 25, 80, 7);
  924.               cursoroff();
  925.               printf("Press any key to continue.....");
  926.               waitkey();
  927.               cursoron();
  928.               exit(0);
  929.           }
  930.  
  931.           This program clears the  screen, turns  off the  cursor, and
  932.           prints  a  prompt.    When  a  key  is  pressed, the program
  933.           continues by turning the cursor back on and exiting.
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.                                                                     11
  947.  
  948.  
  949.  
  950.  
  951.  
  952.                                                          display_error
  953.  
  954.           Summary
  955.  
  956.           #include <extlib.h>
  957.  
  958.           void display_error(errmess);
  959.           char *errmess;                Error message pointer.
  960.  
  961.  
  962.           Description
  963.  
  964.           The display_error routine pop  ups a  window on  the screen,
  965.           displays an  error message  (errmess), and  waits for either
  966.           ENTER or  an O  to be  pressed.   Because display_error uses
  967.           the  mini_menu  routine  to  pop up the window, the window's
  968.           attributes can be changed  by making  appropriate changes to
  969.           _mmatt1 and _mmatt2.
  970.  
  971.  
  972.           Return Value
  973.  
  974.           No value is returned.
  975.  
  976.  
  977.           See Also
  978.  
  979.           mini_menu
  980.  
  981.  
  982.           Example
  983.  
  984.           #include <stdio.h>
  985.           #include <extlib.h>
  986.  
  987.           main()
  988.           {
  989.               save_initial_video();
  990.               display_error("Disk Read Error");
  991.               exit(0);
  992.           }
  993.  
  994.           This program illustrates how a Disk Read Error message might
  995.           be displayed.
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.                                                                     12
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.                                                       display_menu_bar
  1012.  
  1013.           Summary
  1014.  
  1015.           #include <extlib.h>
  1016.  
  1017.           void display_menu_bar(nchoices, menu, row);
  1018.           int nchoices;                 Number of menu choices.
  1019.           MENU *menu;                   Pointer to  an  array  of MENU
  1020.                                         structures.
  1021.           int row;                      Menu bar row.
  1022.  
  1023.  
  1024.           Description
  1025.  
  1026.           The display_menu_bar routine displays a menu bar at row.
  1027.  
  1028.  
  1029.           Return Value
  1030.  
  1031.           No value is returned.
  1032.  
  1033.  
  1034.           See Also
  1035.  
  1036.           menu_bar
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.                                                                     13
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.                                                       display_menu_bar
  1071.  
  1072.           Example
  1073.  
  1074.           #include <stdio.h>
  1075.           #include <extlib.h>
  1076.  
  1077.           void save_file(void);
  1078.           void load_file(void);
  1079.           void exit_program(void);
  1080.  
  1081.           static MENU menu[3] = { {"Save", 0, save_file},
  1082.                                   {"Load", 0, load_file},
  1083.                                   {"Exit", 0, exit_program} };
  1084.  
  1085.           main()
  1086.           {
  1087.               save_initial_video();
  1088.               display_menu_bar(3, menu, 1);
  1089.               waitkey();
  1090.               exit(0);
  1091.           }
  1092.  
  1093.           void save_file(void)
  1094.           {
  1095.           }
  1096.  
  1097.           void load_file(void)
  1098.           {
  1099.           }
  1100.  
  1101.           void exit_program(void)
  1102.           {
  1103.           }
  1104.  
  1105.           This  program  displays  a  menu  bar  consisting  of  three
  1106.           selections at row 1.
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.                                                                     14
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.                                                                drawbox
  1130.  
  1131.           Summary
  1132.  
  1133.           #include <extlib.h>
  1134.  
  1135.           void drawbox(row1, col1, row2, col2, linetype, attribute);
  1136.           int row1, col1;               Upper-left corner of the box.
  1137.           int row2, col2;               Lower-right corner of the box.
  1138.           int linetype;                 Line type flag.
  1139.           int attribute;                Border attribute.
  1140.  
  1141.  
  1142.           Description
  1143.  
  1144.           The drawbox routine draws  a rectangular  box in  the screen
  1145.           area defined  by the  points (row1,  col1) and (row2, col2).
  1146.           Additionally, the  attributes  for  the  border  are  set to
  1147.           attribute.    The  linetype  parameter  can  be  one  of the
  1148.           following manifest constants (defined in extlib.h):
  1149.  
  1150.                Constant            Action
  1151.                _SINGLE_LINE        Draws a single-lined box.
  1152.                _DOUBLE_LINE        Draws a double-lined box.
  1153.  
  1154.  
  1155.           Return Value
  1156.  
  1157.           No value is returned.
  1158.  
  1159.  
  1160.           Example
  1161.  
  1162.           #include <stdio.h>
  1163.           #include <extlib.h>
  1164.  
  1165.           main()
  1166.           {
  1167.               save_initial_video();
  1168.               drawbox(1, 41, 25, 80, _DOUBLE_LINE, 0x70);
  1169.               waitkey();
  1170.               exit(0);
  1171.           }
  1172.  
  1173.           This programs clears the screen and draws a double-lined box
  1174.           in the right half of the screen.
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.                                                                     15
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.                                                            draw_window
  1189.  
  1190.           Summary
  1191.  
  1192.           #include <extlib.h>
  1193.  
  1194.           void draw_window(row1, col1, row2, col2, watt,
  1195.                            bflg [,batt] );
  1196.           int row1, col1;               Upper-left   corner   of   the
  1197.                                         window.
  1198.           int row2, col2;               Lower-right   corner   of  the
  1199.                                         window.
  1200.           int watt;                     Window attribute.
  1201.           int bflg;                     Border flag.
  1202.           int batt;                     Border attribute.
  1203.  
  1204.  
  1205.           Description
  1206.  
  1207.           The draw_window  routine draws  a window  at the coordinates
  1208.           defined by  (row1, col1)  and (row2,  col2).   The window is
  1209.           filled with  an attribute of watt.  If a border is requested
  1210.           by the bflg parameter, the border is drawn with an attribute
  1211.           of batt.   The  bflg parameter  can be  one of the following
  1212.           manifest constants (defined in extlib.h):
  1213.  
  1214.                Constant                 Action
  1215.                _NO_BORDER               The   window   is   drawn
  1216.                                         without a border.
  1217.                _SINGLE_LINE             The window  is drawn with
  1218.                                         a single-lined border.
  1219.                _DOUBLE_LINE             The window  is drawn with
  1220.                                         a double-lined border. 
  1221.  
  1222.  
  1223.           Return Value
  1224.  
  1225.           No value is returned.
  1226.  
  1227.  
  1228.           See Also
  1229.  
  1230.           open_window
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.                                                                     16
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.                                                            draw_window
  1248.  
  1249.           Example
  1250.  
  1251.           #include <stdio.h>
  1252.           #include <extlib.h>
  1253.  
  1254.           main()
  1255.           {
  1256.               save_initial_video();
  1257.               draw_window(10, 30, 15, 50, 0x70, _DOUBLE_LINE, 0x70);
  1258.               waitkey();
  1259.               exit(0);
  1260.           }
  1261.  
  1262.           This program draws a window with a double line border at the
  1263.           coordinates (10, 30) and (15, 50).
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.                                                                     17
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.                                                          error_handler
  1307.  
  1308.           Summary
  1309.  
  1310.           #include <extlib.h>
  1311.  
  1312.           void error_handler(unsigned deverror, unsigned  errcode,    
  1313.           unsigned far *devhdr);
  1314.  
  1315.  
  1316.           Description
  1317.  
  1318.           The  error_handler  routine  is  an  INT 0x24 hardware error
  1319.           handler.  When passed by _harderr, error_handler will pop up
  1320.           on  the  screen  and  display  an appropriate error message.
  1321.           Additionally, error_handler will ask the operator  to select
  1322.           one  of   three  choices:   (Ignore  the  error,  Retry  the
  1323.           operation, or Abort  the  program).    Because error_handler
  1324.           uses the  mini_menu routine,  the window's attributes can be
  1325.           changed  by  making  appropriate  changes  to   _mmatt1  and
  1326.           _mmatt2.
  1327.  
  1328.  
  1329.           Return Value
  1330.  
  1331.           No value is returned.
  1332.  
  1333.  
  1334.           See Also
  1335.  
  1336.           mini_menu and _harderr in the C Run-Time Library Reference.
  1337.  
  1338.  
  1339.           Example
  1340.  
  1341.           #include <stdio.h>
  1342.           #include <extlib.h>
  1343.  
  1344.           main()
  1345.           {
  1346.               _harderr(error_handler);
  1347.               save_initial_video();
  1348.               waitkey();
  1349.               exit(0);
  1350.           }
  1351.  
  1352.           This  program  sets  error_handler  as the INT 0x24 hardware
  1353.           error handler.
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.                                                                     18
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.                                                                fillone
  1366.  
  1367.           Summary
  1368.  
  1369.           #include <extlib.h>
  1370.  
  1371.           void fillone(row, col, chr, attribute);
  1372.           int row, col;                 Screen position.
  1373.           int chr;                      Character.
  1374.           int attribute;                Attribute.
  1375.  
  1376.  
  1377.           Description
  1378.  
  1379.           The fillone routine sets the position defined by  (row, col)
  1380.           to the specified character/attribute pair (chr/attribute).
  1381.  
  1382.  
  1383.           Returned Value
  1384.  
  1385.           No value is returned.
  1386.  
  1387.  
  1388.           Example
  1389.  
  1390.           #include <stdio.h>
  1391.           #include <extlib.h>
  1392.  
  1393.           main()
  1394.           {
  1395.               save_initial_video();
  1396.               fillone(4, 10, 'M', 0x70);
  1397.               waitkey();
  1398.               exit(0);
  1399.           }
  1400.  
  1401.           This program  sets position (4, 10) to an black M on a white
  1402.           background.
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.                                                                     19
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.                                                             fillscreen
  1425.  
  1426.           Summary
  1427.  
  1428.           #include <extlib.h>
  1429.  
  1430.           void fillscreen(row1, col1, row2, col2, chr, attribute);
  1431.           int row1, col1;               Upper-left corner  of the text
  1432.                                         window.
  1433.           int row2, col2;               Lower-right corner of the text
  1434.                                         window.
  1435.           int chr;                      Text window character.
  1436.           int attribute;                Text window attribute.
  1437.  
  1438.  
  1439.           Description
  1440.  
  1441.           The fillscreen routine  fills  the  text  window  defined by
  1442.           (row1, col1)  and (row2,  col2) with the character/attribute
  1443.           pairs specified by chr  and  attribute.    Additionally, the
  1444.           cursor position  is set to the upper-left corner of the text
  1445.           window.
  1446.  
  1447.  
  1448.           Return Value
  1449.  
  1450.           No value is returned.
  1451.  
  1452.  
  1453.           Example
  1454.  
  1455.           #include <stdio.h>
  1456.           #include <extlib.h>
  1457.  
  1458.           main()
  1459.           {
  1460.               save_initial_video();
  1461.               fillscreen(1, 1, 25, 40, 'M', 7);
  1462.               waitkey();
  1463.               exit(0);
  1464.           }
  1465.  
  1466.           This program fills the left  half  of  the  screen  with Ms.
  1467.           Furthermore, the cursor position is set to (1, 1).
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.                                                                     20
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.                                                                   fire
  1484.  
  1485.           Summary
  1486.  
  1487.           #include <extlib.h>
  1488.  
  1489.           int fire(button);
  1490.           int button;                   Button to be read.
  1491.  
  1492.  
  1493.           Description
  1494.  
  1495.           The  fire  routine  reads  a  joystick button, returning the
  1496.           status of the button.  The button parameter can be on of the
  1497.           following manifest constants (defined in extlib.h):
  1498.  
  1499.                Constant                 Action
  1500.                _BUTTON_A_1              Reads button 1 of joystick A.
  1501.                _BUTTON_A_2              Reads button 2 of joystick A.
  1502.                _BUTTON_B_1              Reads button 1 of joystick B.
  1503.                _BUTTON_B_2              Reads button 2 of joystick B.
  1504.  
  1505.  
  1506.           Return Value
  1507.  
  1508.           Returns 1  if the joystick button is being pressed.  Returns
  1509.           0 if the joystick button isn't being pressed.
  1510.  
  1511.  
  1512.           See Also
  1513.  
  1514.           stick
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.                                                                     21
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.                                                                   fire
  1543.  
  1544.           Example
  1545.  
  1546.           #include <stdio.h>
  1547.           #include <extlib.h>
  1548.  
  1549.           main()
  1550.           {
  1551.               save_initial_video();
  1552.               while (!kbhit()) {
  1553.                   setcurpos(1, 1);
  1554.                   printf("%d\n", fire(_BUTTON_A_1));
  1555.                   printf("%d\n", fire(_BUTTON_A_2));
  1556.                   printf("%d\n", fire(_BUTTON_B_1));
  1557.                   printf("%d\n", fire(_BUTTON_B_2));
  1558.               }
  1559.               waitkey();
  1560.               exit(0);
  1561.           }
  1562.  
  1563.           This program reads  and  displays  the  status  of  the four
  1564.           joystick buttons.
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.                                                                     22
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.                                                              getcurpos
  1602.  
  1603.           Summary
  1604.  
  1605.           #include <extlib.h>
  1606.  
  1607.           void getcurpos(row, col, sline, eline);
  1608.           int *row;                     Cursor row position.
  1609.           int *col;                     Cursor column position.
  1610.           int *sline;                   Cursor starting line.
  1611.           int *eline;                   Cursor ending line.
  1612.  
  1613.  
  1614.           Description
  1615.  
  1616.           The  getcurpos  routine  returns  the cursor row position in
  1617.           row, the cursor column position in col, the  cursor starting
  1618.           line in sline, and the cursor ending line in eline.
  1619.  
  1620.  
  1621.           Return Value
  1622.  
  1623.           No value is returned.
  1624.  
  1625.  
  1626.           Example
  1627.  
  1628.           #include <stdio.h>
  1629.           #include <extlib.h>
  1630.  
  1631.           main()
  1632.           {
  1633.               int row, col, sline, eline;
  1634.  
  1635.               settext80();
  1636.               getcurpos(&row, &col, &sline, &eline);
  1637.               clearscreen(1, 1, 25, 80, 7);
  1638.               printf("Row: %d  Column: %d  Starting Line: %d  Ending
  1639.                   Line: %d\n", row, col, sline, eline);
  1640.               waitkey();
  1641.               exit(0);
  1642.           }
  1643.  
  1644.           This  program  obtains  the  cursor  information, clears the
  1645.           screen and prints the information.
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                                                                     23
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.                                                         horizontal_bar
  1661.  
  1662.           Summary
  1663.  
  1664.           #include <extlib.h>
  1665.  
  1666.           void horizontal_bar(window, curpos, total, attribute);
  1667.           WINDOW *window;               Pointer    to    the    window
  1668.                                         coordinates' structure.
  1669.           int curpos;                   Current line position.
  1670.           int total;                    Line length.
  1671.           int attribute;                Scroll bar attribute.
  1672.  
  1673.  
  1674.           Description
  1675.  
  1676.           The horizontal_bar  routine displays a horizontal scroll bar
  1677.           at the bottom of a window  whose coordinates  are pointed to
  1678.           by window.   The  current position in the line is derived by
  1679.           dividing curpos by total.  Additionally,  the scroll  bar is
  1680.           displayed with an attribute of attribute.
  1681.  
  1682.  
  1683.           Return Value
  1684.  
  1685.           No value is returned.
  1686.  
  1687.  
  1688.           See Also
  1689.  
  1690.           vertical_bar and open_window.
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.                                                                     24
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.                                                         horizontal_bar
  1720.  
  1721.           Example
  1722.  
  1723.           #include <stdio.h>
  1724.           #include <extlib.h>
  1725.  
  1726.           main()
  1727.           {
  1728.               WINDOW *window;
  1729.  
  1730.               save_initial_video();
  1731.               window = open_window(1, 30, 10, 70, _DRAW, 7,
  1732.                   _SINGLE_LINE, 7);
  1733.               horizontal_bar(window, 0, 100, 7);
  1734.               waitkey();
  1735.               horizontal_bar(window, 50, 100, 7);
  1736.               waitkey();
  1737.               horizontal_bar(window, 100, 100, 7);
  1738.               waitkey();
  1739.               exit(0);
  1740.           }
  1741.  
  1742.           This  program  opens  a  window and displays scroll bars for
  1743.           various points in a line.
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.                                                                     25
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.                                                           inputdollars
  1779.  
  1780.           Summary
  1781.  
  1782.           #include <extlib.h>
  1783.  
  1784.           int inputdollars(dspinpflg, row, col, length, dvalue);
  1785.           int flag;                     Display/input flag.
  1786.           int row, col;                 Input field position.
  1787.           int length;                   Input field length.
  1788.           double *dvalue;               Input field contents.
  1789.  
  1790.  
  1791.           Description
  1792.  
  1793.           The inputdollars routine will  display or  display and input
  1794.           (as indicated  by dspinpflg)  a right-justified dollar value
  1795.           (dvalue)  with  a  field  length  of  length  at  the screen
  1796.           position  defined  by  (row,  col).  During input, HOME will
  1797.           erase the value and  start  the  input  from  the beginning.
  1798.           BACK SPACE  will erase the last digit entered. The dspinpflg
  1799.           parameter can be one  of  the  following  manifest constants
  1800.           (defined in extlib.h):
  1801.  
  1802.                Constant                 Action
  1803.                _DISPLAY_ONLY            Only display the field.
  1804.                _INPUT                   Display   the  field  and
  1805.                                         then get the input.
  1806.  
  1807.  
  1808.           Return Value
  1809.  
  1810.           Inputdollars returns the value of the last key  pressed (see
  1811.           waitkey).
  1812.  
  1813.  
  1814.           Example
  1815.  
  1816.           #include <stdio.h>
  1817.           #include <extlib.h>
  1818.  
  1819.           main()
  1820.           {
  1821.               double amount;
  1822.  
  1823.               save_initial_video();
  1824.               while(inputdollars(_INPUT, 13, 41, 10, &amount) != 27);
  1825.               exit(0);
  1826.           }
  1827.  
  1828.           This program inputs dollar values until ESC is pressed.
  1829.  
  1830.  
  1831.                                                                     26
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.                                                            inputfields
  1838.  
  1839.           Summary
  1840.  
  1841.           #include <extlib.h>
  1842.  
  1843.           void  inputfields(number,  first,  row, col, length, typflg,
  1844.                inpptr, [...]);
  1845.           int number;                   Number of input fields.
  1846.           int first;                    First input field.
  1847.           int row, col;                 Input field position.
  1848.           int length;                   Input field length.
  1849.           int typflg;                   Type of input.
  1850.           char *inpptr;                 String field's contents.
  1851.           long *inpptr;                 Numeric field's contents.
  1852.           double *inpptr;               Dollar field's contents.
  1853.  
  1854.  
  1855.           Description
  1856.  
  1857.           The inputfields routine provides input for  multiple fields.
  1858.           The number  of fields is specified by number.  Each field is
  1859.           defined by specifying its position (row,  col), length, type
  1860.           (typflg),  and   an  appropriate  pointer  (inpptr)  to  its
  1861.           contents.  Input is started  at  the  first  field.   During
  1862.           input the following control keys are active:
  1863.  
  1864.                Key                      Action
  1865.                UP ARROW                 Move   to   the  previous
  1866.                                         field.
  1867.                DOWN ARROW or ENTER      Move to the next field.
  1868.                ESC                      End the input.
  1869.  
  1870.           The typflg parameter can  be one  of the  following manifest
  1871.           constants (defined in extlib.h):
  1872.  
  1873.                Constant                 Action
  1874.                _STRING                  Gets string  input at the
  1875.                                         specified field.
  1876.                _NUMBER                  Gets numeric input at the
  1877.                                         specified field.
  1878.                _DOLLARS                 Gets dollar  input at the
  1879.                                         specified field.
  1880.  
  1881.  
  1882.           Return Value
  1883.  
  1884.           No value is returned.
  1885.  
  1886.  
  1887.           See Also
  1888.  
  1889.  
  1890.                                                                     27
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.                                                            inputfields
  1897.  
  1898.           inputdollars,   inputnumber,    inputstring,   printdelimit,
  1899.           printfields, and printheads.
  1900.  
  1901.  
  1902.           Example
  1903.  
  1904.           #include <stdio.h>
  1905.           #include <extlib.h>
  1906.  
  1907.           main()
  1908.           {
  1909.               long number;
  1910.               char name[31];
  1911.               double balance;
  1912.  
  1913.               save_initial_video();
  1914.               printheads(3, 1, 1, "Account Number", 2, 1,
  1915.                   "Account Name", 3, 1, "Account Balance");
  1916.               printdelimit('[', ']', 3, 1, 40, 6, 2, 40, 30, 3,
  1917.                   40, 10);
  1918.               number = balance = name[0] = 0;
  1919.               inputfields(3, 0, 1, 40, 6, _NUMBER, &number, 2, 40,
  1920.                   30, _STRING, name, 3, 40, 10, _DOLLARS, &balance);
  1921.               exit(0);
  1922.           }
  1923.  
  1924.           This program  requests information  for an account by asking
  1925.           for the account's number, name, and balance.
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.                                                                     28
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.                                                            inputnumber
  1956.  
  1957.           Summary
  1958.  
  1959.           #include <extlib.h>
  1960.  
  1961.           int inputnumber(dspinpflg, row, col, length, number);
  1962.           int flag;                     Display/input flag.
  1963.           int row, col;                 Input field position.
  1964.           int length;                   Input field length.
  1965.           long *number;                 Input field contents.
  1966.  
  1967.  
  1968.           Description
  1969.  
  1970.           The inputnumber  routine will  display or  display and input
  1971.           (as indicated  by dspinpflg) a right-justified numeric value
  1972.           (number)  with  a  field  length  of  length  at  the screen
  1973.           position  defined  by  (row,  col).  During input, HOME will
  1974.           erase the value and  start  the  input  from  the beginning.
  1975.           BACK SPACE  will erase the last digit entered. The dspinpflg
  1976.           parameter can be one  of  the  following  manifest constants
  1977.           (defined in extlib.h):
  1978.  
  1979.                Constant                 Action
  1980.                _DISPLAY_ONLY            Only display the field.
  1981.                _INPUT                   Display   the  field  and
  1982.                                         then get the input.
  1983.  
  1984.  
  1985.           Return Value
  1986.  
  1987.           Inputnumber returns the value of the  last key  pressed (see
  1988.           waitkey).
  1989.  
  1990.  
  1991.           Example
  1992.  
  1993.           #include <stdio.h>
  1994.           #include <extlib.h>
  1995.  
  1996.           main()
  1997.           {
  1998.               long amount = 0;
  1999.  
  2000.               save_initial_video();
  2001.               while (inputnumber(_INPUT, 13, 41, 10, &amount) != 27);
  2002.               exit(0);
  2003.           }
  2004.  
  2005.           This program inputs numeric values until ESC is pressed.
  2006.  
  2007.  
  2008.                                                                     29
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.                                                            inputstring
  2015.  
  2016.           Summary
  2017.  
  2018.           #include <extlib.h>
  2019.  
  2020.           int inputstring(dspinpflg, row, col, length, string);
  2021.           int flag;                     Display/input flag.
  2022.           int row, col;                 Input field position.
  2023.           int length;                   Input field length.
  2024.           char *string;                 Input field contents.
  2025.  
  2026.  
  2027.           Description
  2028.  
  2029.           The inputstring  routine will  display or  display and input
  2030.           (as indicated by dspinpflg)  a left-justified  string with a
  2031.           field  length  of  length  at the screen position defined by
  2032.           (row, col).  During  input, HOME  will erase  the string and
  2033.           start the  input from  the beginning.  BACK SPACE will erase
  2034.           the last character entered.  The dspinpflg  parameter can be
  2035.           one  of   the  following   manifest  constants  (defined  in
  2036.           extlib.h):
  2037.  
  2038.                Constant                 Action
  2039.                _DISPLAY_ONLY            Only display the field.
  2040.                _INPUT                   Display  the   field  and
  2041.                                         then get the input.
  2042.  
  2043.  
  2044.           Return Value
  2045.  
  2046.           Inputstring returns  the value  of the last key pressed (see
  2047.           waitkey).
  2048.  
  2049.  
  2050.           Example
  2051.  
  2052.           #include <stdio.h>
  2053.           #include <extlib.h>
  2054.  
  2055.           main()
  2056.           {
  2057.               char string[31];
  2058.  
  2059.               save_initial_video();
  2060.               string[0] = 0;
  2061.               while (inputstring(_INPUT, 13, 41, 30, string) != 27) ;
  2062.               exit(0);
  2063.           }
  2064.  
  2065.           This program inputs strings until ESC is pressed.
  2066.  
  2067.                                                                     30
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.                                                               menu_bar
  2074.  
  2075.           Summary
  2076.  
  2077.           #include <extlib.h>
  2078.  
  2079.           int menu_bar(nchoices, menu, row);
  2080.           int nchoices;                 Number of menu choices.
  2081.           MENU *menu;                   Pointer to  an  array  of MENU
  2082.                                         structures.
  2083.           int row;                      Menu bar row.
  2084.  
  2085.  
  2086.           Description
  2087.  
  2088.           The menu_bar  routine displays  a menu bar at row.  Whenever
  2089.           a hotkey (ALT plus  the indicted  key) is  pressed, menu_bar
  2090.           passes program control to the specified menu routine.
  2091.  
  2092.  
  2093.           Return Value
  2094.  
  2095.           If  a  hotkey  is  pressed,  menu_bar  returns a value of 0.
  2096.           Otherwise,  menu_bar  returns  the  value  of  the  last key
  2097.           pressed.
  2098.  
  2099.  
  2100.           See Also
  2101.  
  2102.           display_menu_bar
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.                                                                     31
  2127.  
  2128.  
  2129.  
  2130.  
  2131.  
  2132.                                                               menu_bar
  2133.  
  2134.           Example
  2135.  
  2136.           #include <stdio.h>
  2137.           #include <extlib.h>
  2138.  
  2139.           void save_file(void);
  2140.           void load_file(void);
  2141.           void exit_program(void);
  2142.  
  2143.           static MENU menu[3] = { {"Save", 0, save_file},
  2144.                                   {"Load", 0, load_file},
  2145.                                   {"Exit", 0, exit_program} };
  2146.  
  2147.           main()
  2148.           {
  2149.               save_initial_video();
  2150.               cursoron();
  2151.               while (TRUE) {
  2152.                   setcurpos(13, 1);
  2153.                   printf("%3d", menu_bar(3, menu, 1));
  2154.               }
  2155.           }
  2156.  
  2157.           void save_file(void)
  2158.           {
  2159.               display_error("Save file has been selected");
  2160.           }
  2161.  
  2162.           void load_file(void)
  2163.           {
  2164.               display_error("Load file has been selected");
  2165.           }
  2166.  
  2167.           void exit_program(void)
  2168.           {
  2169.               exit(0);
  2170.           }
  2171.  
  2172.           This program  displays a  menu bar and will continuously ask
  2173.           for a selection until Exit (ALT E) is chosen.
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.                                                                     32
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.                                                              mini_menu
  2192.  
  2193.           Summary
  2194.  
  2195.           #include <extlib.h>
  2196.  
  2197.           int mini_menu(row, col, nchoices, menu,
  2198.                ntitles, [title, ...]);
  2199.           int row, col;                 Screen position  to center the
  2200.                                         menu on.
  2201.           int nchoices;                 Number of menu choices.
  2202.           MENU *menu;                   Pointer  to  an  array of MENU
  2203.                                         structures.
  2204.           int ntitles;                  Number of titles.
  2205.           char *titles;                 Title pointer.
  2206.  
  2207.  
  2208.           Description
  2209.  
  2210.           The mini_menu routine displays a menu by centering it at the
  2211.           coordinates  defined  by  (row,  col).  Any specified titles
  2212.           will be displayed above  the menu  choices.   Selection of a
  2213.           menu  item  is  accomplished  by  selecting  the appropriate
  2214.           hotkey (the letter indicated).  However, the choice with the
  2215.           double-lined border  can be  selected at anytime by pressing
  2216.           ENTER.  The double-lined border is moved by  pressing either
  2217.           the LEFT ARROW or the RIGHT ARROW keys.
  2218.  
  2219.  
  2220.           Return Value
  2221.  
  2222.           If the  menu selection's  function is set to NULL, mini_menu
  2223.           returns the value of  the  selection's  hotkey.   Otherwise,
  2224.           mini_menu returns a value of 0.
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.                                                                     33
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.                                                              mini_menu
  2251.  
  2252.           Example
  2253.  
  2254.           #include <stdio.h>
  2255.           #include <extlib.h>
  2256.  
  2257.           void save_file(void);
  2258.  
  2259.           static MENU menu[3] = { {"Yes", 0, save_file},
  2260.                                   {"No", 0, NULL},
  2261.                                   {"Cancel", 0, NULL} };
  2262.  
  2263.           main()
  2264.           {
  2265.               save_initial_video();
  2266.               while (mini_menu(13, 40, 3, menu, 2,
  2267.                   "The file hasn't been saved!",
  2268.                   "Do you want me to save it?") != 'C') ;
  2269.               exit(0);
  2270.           }
  2271.  
  2272.           void save_file(void)
  2273.           {
  2274.               display_error("The file has been saved");
  2275.           }
  2276.  
  2277.           This program  asks if  a file should be saved on exit from a
  2278.           program.
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.                                                                     34
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.                                                            open_window
  2310.  
  2311.           Summary
  2312.  
  2313.           #include <extlib.h>
  2314.  
  2315.           WINDOW *open_window(row1, col1, row2, col2,
  2316.                               dflg[, watt, bflg[, batt]]);
  2317.           int row1, col1;               Upper-left   corner   of   the
  2318.                                         window.
  2319.           int row2, col2;               Lower-right   corner   of  the
  2320.                                         window.
  2321.           int dflg;                     Draw window flag.
  2322.           int watt;                     Window attribute.
  2323.           int bflg;                     Border flag.
  2324.           int batt;                     Border attribute.
  2325.  
  2326.  
  2327.           Description
  2328.  
  2329.           The open_window  routine opens  a window  at the coordinates
  2330.           defined by  (row1, col1)  and (row2,  col2).   The window is
  2331.           drawn, if the dflg so indicates, by clearing  the window and
  2332.           setting  the  window's  attributes  to watt.  Furthermore, a
  2333.           border will be drawn according to the bflg.  If  a border is
  2334.           drawn, its  attributes are  set to batt.  The dflg parameter
  2335.           can be one of the following  manifest constants  (defined in
  2336.           extlib.h):
  2337.  
  2338.                Constant                 Action
  2339.                _DRAW                    Draw the window.
  2340.                _NO_DRAW                 Leave     the    window's
  2341.                                         contents intact.
  2342.  
  2343.           The bflg parameter  can  be  on  of  the  following manifest
  2344.           constants (defined in extlib.h):
  2345.  
  2346.                Constant                 Action
  2347.                _NO_BORDER               The   window   is   drawn
  2348.                                         without a border.
  2349.                _SINGLE_LINE             The window  is drawn with
  2350.                                         a single-lined border.
  2351.                _DOUBLE_LINE             The window  is drawn with
  2352.                                         a double-lined border.
  2353.  
  2354.  
  2355.           Return Value
  2356.  
  2357.           open_window returns a pointer with the type WINDOW.
  2358.  
  2359.  
  2360.  
  2361.  
  2362.                                                                     35
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.                                                            open_window
  2369.  
  2370.           See Also
  2371.  
  2372.           close_window
  2373.  
  2374.  
  2375.           Example
  2376.  
  2377.           #include <stdio.h>
  2378.           #include <extlib.h>
  2379.  
  2380.           main()
  2381.           {
  2382.               WINDOW *window;
  2383.  
  2384.               save_initial_video();
  2385.               window = open_window(1, 20, 15, 50, _DRAW, 0x70,
  2386.                _SINGLE_LINE, 0x70);
  2387.               waitkey();
  2388.               window = close_window(window);
  2389.               exit(0);
  2390.           }
  2391.  
  2392.           This program opens a text window at the  coordinates (1, 20)
  2393.           and (15,  50).   After waiting  for a key to be pressed, the
  2394.           program continues by closing the window.
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.                                                                     36
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.                                                                  popup
  2428.  
  2429.           Summary
  2430.  
  2431.           #include <extlib.h>
  2432.  
  2433.           int popup(number, menu, row, col);
  2434.           int number;                   Number of menu choices.
  2435.           MENU *menu;                   Pointer to  an  array  of MENU
  2436.                                         structures.
  2437.           int row;                      Upper row for the menu.
  2438.           int col;                      Column to center the menu on.
  2439.  
  2440.  
  2441.           Description
  2442.  
  2443.           The popup  routine displays a popup menu starting at row and
  2444.           centered on  the column  defined by  (col).   Selection of a
  2445.           menu  item  is  accomplished  by  pressing  the  appropriate
  2446.           hotkey  (the  letter  indicated)   or  by   pressing  ENTER.
  2447.           Pressing ENTER,  will select the highlighted menu selection.
  2448.           The highlighting can be move by pressing either the UP ARROW
  2449.           or the DOWN ARROW key.  Pressing ESC will cancel the menu.
  2450.  
  2451.  
  2452.           Return Value
  2453.  
  2454.           If  the  menu  selection's  function  is  set to NULL, popup
  2455.           returns the value of  the  selection's  hotkey.   Otherwise,
  2456.           pop_up returns a value of 0.
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.                                                                     37
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.                                                                  popup
  2487.  
  2488.           Example
  2489.  
  2490.           #include <stdio.h>
  2491.           #include <extlib.h>
  2492.  
  2493.           void save_file(void);
  2494.           void load_file(void);
  2495.  
  2496.           static MENU menu[4] = { {"Save the File", 0, save_file},
  2497.                                   {"Load the File", 0, load_file},
  2498.                                   {"", 0, NULL},
  2499.                                   {"Exit the Program", 0, NULL} };
  2500.  
  2501.           main()
  2502.           {
  2503.               save_initial_video();
  2504.               while (!popup(4, menu, 3, 40)) ;
  2505.               exit(0);
  2506.           }
  2507.  
  2508.           void save_file(void)
  2509.           {
  2510.               display_error("Saving the file");
  2511.           }
  2512.  
  2513.           void load_file(void)
  2514.           {
  2515.               display_error("Loading the file");
  2516.           }
  2517.  
  2518.           This  program  continuously  displays  a menu until the Exit
  2519.           choice is selected.
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.                                                                     38
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.                                                            printcenter
  2546.  
  2547.           Summary
  2548.  
  2549.           #include <extlib.h>
  2550.  
  2551.           void printcenter(row, col, string);
  2552.           int row;                      String row.
  2553.           int col;                      String center column.
  2554.           char *string;                 String pointer.
  2555.  
  2556.  
  2557.           Description
  2558.  
  2559.           The printcenter routine prints a string  by centering  it at
  2560.           the specified  column (col)  on the  display line defined by
  2561.           row.
  2562.  
  2563.  
  2564.           Return Value
  2565.  
  2566.           No value is returned.
  2567.  
  2568.  
  2569.           Example
  2570.  
  2571.           #include <stdio.h>
  2572.           #include <extlib.h>
  2573.  
  2574.           main()
  2575.           {
  2576.               save_initial_video();
  2577.               printcenter(1, 40, "This message is centered");
  2578.               waitkey();
  2579.               exit(0);
  2580.           }
  2581.  
  2582.           This program displays a message at the center of line one.
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.                                                                     39
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.                                                           printdelimit
  2605.  
  2606.           Summary
  2607.  
  2608.           #include <extlib.h>
  2609.  
  2610.           void printdelimit(ldel, rdel, number, row,
  2611.                             col, length, [...]);
  2612.           int ldel;                     Left delimiter.
  2613.           int rdel;                     Right delimiter.
  2614.           int number;                   Number of input fields.
  2615.           int row, col;                 Input field position.
  2616.           int length;                   Input field length.
  2617.  
  2618.  
  2619.           Description
  2620.  
  2621.           The printdelimit routine prints  delimiters around  a number
  2622.           of  input  fields.    A  left  delimiter  (ldel) and a right
  2623.           delimiter (rdel) is displayed  around each  field.   A field
  2624.           is  defined  to  start  at  (row,  col) and have a length of
  2625.           length.
  2626.  
  2627.  
  2628.           Return Value
  2629.  
  2630.           No value is returned.
  2631.  
  2632.  
  2633.           See Also
  2634.  
  2635.           inputdollars,    inputfields,    inputnumber,   inputstring,
  2636.           printfields, and printheads.
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.                                                                     40
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.                                                           printdelimit
  2664.  
  2665.           Example
  2666.  
  2667.           #include <stdio.h>
  2668.           #include <extlib.h>
  2669.  
  2670.           main()
  2671.           {
  2672.               long number;
  2673.               char name[31];
  2674.               double balance;
  2675.  
  2676.               save_initial_video();
  2677.               printheads(3, 1, 1, "Account Number", 2, 1,
  2678.                   "Account Name", 3, 1, "Account Balance");
  2679.               printdelimit('[', ']', 3, 1, 40, 6, 2, 40, 
  2680.                   30, 3, 40, 10);
  2681.               number = balance = name[0] = 0;
  2682.               inputfields(3, 0, 1, 40, 6, _NUMBER, &number, 2, 40,
  2683.                   30, _STRING, name, 3, 40, 10, _DOLLARS, &balance);
  2684.               exit(0);
  2685.           }
  2686.  
  2687.           This program  requests information  for an account by asking
  2688.           for the account's number, name, and balance.
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.                                                                     41
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.                                                            printfields
  2723.  
  2724.           Summary
  2725.  
  2726.           #include <extlib.h>
  2727.  
  2728.           void printfields(number,  row, col,  length, typflg, inpptr,
  2729.                     [...]);
  2730.           int number;                   Number of fields.
  2731.           int row, col;                 Field position.
  2732.           int length;                   Field length.
  2733.           int typflg;                   Field type.
  2734.           char *inpptr;                 String field pointer.
  2735.           long *inpptr;                 Numeric field pointer.
  2736.           double *inpptr;               Dollar field pointer.
  2737.  
  2738.  
  2739.           Description
  2740.  
  2741.           The printfields  routine is used to display multiple fields.
  2742.           The number of fields is specified by number.  Each  field is
  2743.           defined by specifying it's position (row, col), length, type
  2744.           (typflg), and an appropriate pointer (inpptr) to the field's
  2745.           contents.   The typflg parameter can be one of the following
  2746.           manifest constants (defined in extlib.h):
  2747.  
  2748.                Constant                 Action
  2749.                _STRING                  Displays a string field.
  2750.                _NUMBER                  Displays a numeric field.
  2751.                _DOLLARS                 Displays a dollar field.
  2752.  
  2753.  
  2754.           Return Value
  2755.  
  2756.           No value is returned.
  2757.  
  2758.  
  2759.           See Also
  2760.  
  2761.           inputdollars,    inputfields,    inputnumber,   inputstring,
  2762.           printdelimit, and printheads.
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.                                                                     42
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.                                                            printfields
  2782.  
  2783.           Example
  2784.  
  2785.           #include <stdio.h>
  2786.           #include <extlib.h>
  2787.  
  2788.           main()
  2789.           {
  2790.               long number;
  2791.               char name[31];
  2792.               double balance;
  2793.  
  2794.               save_initial_video();
  2795.               printheads(3, 1, 1, "Account Number", 2, 1, 
  2796.                   "Account Name", 3, 1, "Account Balance");
  2797.               printdelimit('[', ']', 3, 1, 40, 6, 2, 40, 
  2798.                   30, 3, 40, 10);
  2799.               number = balance = name[0] = 0;
  2800.               inputfields(3, 0, 1, 40, 6, _NUMBER, &number, 2, 40,
  2801.                   30, _STRING, name, 3, 40, 10, _DOLLARS, &balance);
  2802.               exit(0);
  2803.           }
  2804.  
  2805.           This program  requests information  for an account by asking
  2806.           for the account's number, name, and balance.
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.                                                                     43
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.                                                             printheads
  2841.  
  2842.           Summary
  2843.  
  2844.           #include <extlib.h>
  2845.  
  2846.           void printheads(number[, row, col, string, [...]);
  2847.           int number;                   Number of headings.
  2848.           int row, col;                 Heading position.
  2849.           char *string;                 Heading pointer.
  2850.  
  2851.  
  2852.           Description
  2853.  
  2854.           The printheads routine is  used  to  display  multiple field
  2855.           headings.    The  number  of  headings  to  be  displayed is
  2856.           defined by number.    Each  heading's  (string)  position is
  2857.           defined by specifying it's position (row, col).
  2858.  
  2859.  
  2860.           Return Value
  2861.  
  2862.           No value is returned.
  2863.  
  2864.  
  2865.           See Also
  2866.  
  2867.           inputdollars,    inputfields,    inputnumber,   inputstring,
  2868.           printdelimit, and printfields.
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.                                                                     44
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.                                                             printheads
  2900.  
  2901.           Example
  2902.  
  2903.           #include <stdio.h>
  2904.           #include <extlib.h>
  2905.  
  2906.           main()
  2907.           {
  2908.               long number;
  2909.               char name[31];
  2910.               double balance;
  2911.  
  2912.               save_initial_video();
  2913.               printheads(3, 1, 1, "Account Number", 2, 1, 
  2914.                   "Account Name", 3, 1, "Account Balance");
  2915.               printdelimit('[', ']', 3, 1, 40, 6, 2, 40, 
  2916.                   30, 3, 40, 10);
  2917.               number = balance = name[0] = 0;
  2918.               inputfields(3, 0, 1, 40, 6, _NUMBER, &number, 2, 40, 30,
  2919.                   _STRING, name, 3, 40, 10, _DOLLARS, &balance);
  2920.               exit(0);
  2921.           }
  2922.  
  2923.           This program requests information  for an  account by asking
  2924.           for the account's number, name, and balance.
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.                                                                     45
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.                                                               printone
  2959.  
  2960.           Summary
  2961.  
  2962.           #include <extlib.h>
  2963.  
  2964.           void printone(row, col, chr);
  2965.           int row, col;                 Character position.
  2966.           int chr;                      Character.
  2967.  
  2968.  
  2969.           Description
  2970.  
  2971.           The  printone  routine  displays  a  character  (chr) at the
  2972.           position defined by (row, col).
  2973.  
  2974.  
  2975.           Return Value
  2976.  
  2977.           No value is returned.
  2978.  
  2979.  
  2980.           Example
  2981.  
  2982.           #include <stdio.h>
  2983.           #include <extlib.h>
  2984.  
  2985.           main()
  2986.           {
  2987.               save_initial_video();
  2988.               printone(5, 40, 'Z');
  2989.               waitkey();
  2990.               exit(0);
  2991.           }
  2992.  
  2993.           This program displays a Z at position (5, 40).
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.                                                                     46
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.                                                            printstring
  3018.  
  3019.           Summary
  3020.  
  3021.           #include <extlib.h>
  3022.  
  3023.           void printstring(row, col, string);
  3024.           int row, col;                 String position.
  3025.           char *string;                 String pointer.
  3026.  
  3027.  
  3028.           Description
  3029.  
  3030.           The printstring  routine displays  a string  at the position
  3031.           defined by (row, col).
  3032.  
  3033.  
  3034.           Return Value
  3035.  
  3036.           No value is returned.
  3037.  
  3038.  
  3039.           Example
  3040.  
  3041.           #include <stdio.h>
  3042.           #include <extlib.h>
  3043.  
  3044.           main()
  3045.           {
  3046.               save_initial_video();
  3047.               printstring(2, 10, "This is row 2, column 10");
  3048.               waitkey();
  3049.               exit(0);
  3050.           }
  3051.  
  3052.           This program displays a string at row 2, column 10.
  3053.  
  3054.  
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066.  
  3067.  
  3068.  
  3069.  
  3070.                                                                     47
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.                                                               pulldown
  3077.  
  3078.           Summary
  3079.  
  3080.           #include <extlib.h>
  3081.  
  3082.           int pulldown(nummenus, menus, row);
  3083.           int nummenus;                 Number of pulldown menus.
  3084.           MENU_HEAD *menus;             Pointer   to   an   array   of
  3085.                                         MENU_HEAD structures.
  3086.           int row;                      Menu bar row.
  3087.  
  3088.  
  3089.           Description
  3090.  
  3091.           The pulldown routine is used to  implement multiple pulldown
  3092.           menus.  The number of pulldown menus is defined by nummenus.
  3093.           Each of the pulldown  menus  is  defined  by  an appropriate
  3094.           MENU_HEAD structure.  This structure includes definitions of
  3095.           the menu's heading, hotkey, and a pointer to  an appropriate
  3096.           MENU structure.   At  the start  of the  pulldown routine, a
  3097.           menu bar is displayed on the specified row.   This  menu bar
  3098.           lists each  one of the menus' headings.  During the pulldown
  3099.           routine the following control keys are active:
  3100.  
  3101.                Key                      Action
  3102.                ALT + Heading Hotkey     Pulls down  the indicated
  3103.                                         menu.
  3104.                ESC                      Removes  the current menu
  3105.                                         from the screen.
  3106.                LEFT ARROW               Removes the  current menu
  3107.                                         from the screen and pulls
  3108.                                         down the next menu to the
  3109.                                         left.
  3110.                RIGHT ARROW              Removes  the current menu
  3111.                                         from the screen and pulls
  3112.                                         down the next menu to the
  3113.                                         right.
  3114.                Menu Item Hotkey         Executes  the appropriate
  3115.                                         menu item's function.
  3116.                ENTER                    Executes  the highlighted
  3117.                                         menu item's function.
  3118.                UP ARROW                 Moves  the  highlight bar
  3119.                                         up  to  the previous menu
  3120.                                         item.
  3121.                DOWN ARROW               Moves  the  highlight bar
  3122.                                         down to the previous menu
  3123.                                         item.
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.                                                                     48
  3130.  
  3131.  
  3132.  
  3133.  
  3134.  
  3135.                                                               pulldown
  3136.  
  3137.           Return Value
  3138.  
  3139.           If a menu item isn't selected, pulldown returns the value of
  3140.           the last  key pressed.   Otherwise, pulldown returns a value
  3141.           of 0.
  3142.  
  3143.  
  3144.           See Also
  3145.  
  3146.           pulldown_bar
  3147.  
  3148.  
  3149.           Example
  3150.  
  3151.           #include <stdio.h>
  3152.           #include <extlib.h>
  3153.  
  3154.           void save_file(void);
  3155.           void read_file(void);
  3156.           void exit_prog(void);
  3157.           void add_acc(void);
  3158.           void del_acc(void);
  3159.           void add_tra(void);
  3160.           void del_tra(void);
  3161.           void prt_coa(void);
  3162.           void led_upd(void);
  3163.           void fin_stat(void);
  3164.  
  3165.           static MENU file[3] = { {"Save the File", 0, save_file},
  3166.               {"Read the File", 0, read_file},
  3167.               {"Exit the Program", 0, exit_prog} };
  3168.  
  3169.           static MENU accounts[2] = { {"Add an Account", 0, add_acc},
  3170.               {"Delete an Account", 0, del_acc} };
  3171.  
  3172.           static MENU transact[2] = { {"Add a Transaction", 0,
  3173.               add_tra},
  3174.               {"Delete a Transaction", 0, del_tra} };
  3175.  
  3176.           static MENU print[4] = { {"Print a Chart of Accounts", 8,
  3177.               prt_coa},
  3178.               {"Print a Ledger Update", 15, led_upd},
  3179.               {"", 0, NULL},
  3180.               {"Print Financial Statements", 6, fin_stat} };
  3181.  
  3182.           static MENU_HEAD heads[4] = { {"File", 0, 3, file},
  3183.               {"Accounts", 0, 2, accounts},
  3184.               {"Transactions", 0, 2, transact},
  3185.               {"Print", 0, 4, print} } ;
  3186.  
  3187.  
  3188.                                                                     49
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.                                                               pulldown
  3195.  
  3196.           main()
  3197.           {
  3198.               save_initial_video();
  3199.               while (TRUE) {
  3200.                   setcurpos(13, 1);
  3201.                   printf("%3d", pulldown(4, heads, 1));
  3202.               }
  3203.           }
  3204.  
  3205.           void save_file(void)
  3206.           {
  3207.               display_error("Saving the File");
  3208.           }
  3209.  
  3210.           void read_file(void)
  3211.           {
  3212.               display_error("Reading the File");
  3213.           }
  3214.  
  3215.           void exit_prog(void)
  3216.           {
  3217.               exit(0);
  3218.           }
  3219.  
  3220.           void add_acc(void)
  3221.           {
  3222.               display_error("Adding an Account");
  3223.           }
  3224.  
  3225.           void del_acc(void)
  3226.           {
  3227.               display_error("Deleting an Account");
  3228.           }
  3229.  
  3230.           void add_tra(void)
  3231.           {
  3232.               display_error("Adding a Transaction");
  3233.           }
  3234.  
  3235.           void del_tra(void)
  3236.           {
  3237.               display_error("Deleting a Transaction");
  3238.           }
  3239.  
  3240.           void prt_coa(void)
  3241.           {
  3242.               display_error("Printing a Chart of Accounts");
  3243.           }
  3244.  
  3245.           void led_upd(void)
  3246.  
  3247.                                                                     50
  3248.  
  3249.  
  3250.  
  3251.  
  3252.  
  3253.                                                               pulldown
  3254.  
  3255.           {
  3256.               display_error("Printing a Ledger Update");
  3257.           }
  3258.  
  3259.           void fin_stat(void)
  3260.           {
  3261.               display_error("Print the Financial Statements");
  3262.           }
  3263.  
  3264.           This program will  continuously  execute  the  pulldown menu
  3265.           routine until the Exit Program function is selected from the
  3266.           File menu.
  3267.  
  3268.  
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.                                                                     51
  3307.  
  3308.  
  3309.  
  3310.  
  3311.  
  3312.                                                           pulldown_bar
  3313.  
  3314.           Summary
  3315.  
  3316.           #include <extlib.h>
  3317.  
  3318.           void pulldown_bar(nummenus, menus, row);
  3319.           int nummenus;                 Number of pulldown menus.
  3320.           MENU_HEAD *menus;             Pointer   to   an   array   of
  3321.                                         MENU_HEAD structures.
  3322.           int row;                      Menu bar row.
  3323.  
  3324.  
  3325.           Description
  3326.  
  3327.           The pulldown_bar  routine is used to display a pulldown menu
  3328.           bar.   The number  of pulldown  menu headings  is defined by
  3329.           nummenus.  Each of the headings is defined in an appropriate
  3330.           MENU_HEAD  structure.    Additionally,   the  menu   bar  is
  3331.           displayed on the specified row.
  3332.  
  3333.  
  3334.           Return Value
  3335.  
  3336.           No value is returned.
  3337.  
  3338.  
  3339.           See Also
  3340.  
  3341.           pulldown
  3342.  
  3343.  
  3344.           Example
  3345.  
  3346.           #include <stdio.h>
  3347.           #include <extlib.h>
  3348.  
  3349.           static MENU_HEAD heads[4] = { {"File", 0, 0, NULL},
  3350.               {"Accounts", 0, 0, NULL},
  3351.               {"Transactions", 0, 0, NULL},
  3352.               {"Print", 0, 0, NULL} } ;
  3353.  
  3354.           main()
  3355.           {
  3356.               save_initial_video();
  3357.               pulldown_bar(4, heads, 1);
  3358.               waitkey();
  3359.               exit(0);
  3360.           }
  3361.  
  3362.           This program displays a pulldown menu bar on the top line of
  3363.           the display.
  3364.  
  3365.                                                                     52
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.                                                          restorescreen
  3372.  
  3373.           Summary
  3374.  
  3375.           #include <extlib.h>
  3376.  
  3377.           void restorescreen(row1, col1, row2, col2, buffer);
  3378.           int row1, col1;               Upper-left corner  of the text
  3379.                                         window.
  3380.           int row2, col2;               Lower-right corner of the text
  3381.                                         window.
  3382.           char *buffer;                 Buffer pointer.
  3383.  
  3384.  
  3385.           Description
  3386.  
  3387.           The restorescreen routine displays a text  window defined by
  3388.           the  points  (row1,  col1)  and  (row2,  col2)  from buffer.
  3389.           Because each of the  text window's  characters consist  of a
  3390.           character/attribute pair, the buffer must be ((row2 - row1 +
  3391.           1) * (col2 - col1 + 1) * 2)  bytes long.
  3392.  
  3393.  
  3394.           Return Value
  3395.  
  3396.           No value is returned.
  3397.  
  3398.  
  3399.           See Also
  3400.  
  3401.           savescreen
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.                                                                     53
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.                                                          restorescreen
  3431.  
  3432.           Example
  3433.  
  3434.           #include <stdio.h>
  3435.           #include <extlib.h>
  3436.  
  3437.           static char vbuff[4000];
  3438.  
  3439.           main()
  3440.           {
  3441.               settext80();
  3442.               savescreen(1, 1, 25, 80, vbuff);
  3443.               clearscreen(1, 1, 25, 80, 7);
  3444.               waitkey();
  3445.               restorescreen(1, 1, 25, 80, vbuff);
  3446.               waitkey();
  3447.               exit(0);
  3448.           }
  3449.  
  3450.           This program copies the screen into a buffer and then clears
  3451.           the screen.   After  waiting for a key, the program restores
  3452.           the previous screen display.
  3453.  
  3454.  
  3455.  
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.                                                                     54
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.                                                     save_initial_video
  3490.  
  3491.           Summary
  3492.  
  3493.           #include <extlib.h>
  3494.  
  3495.           void save_initial_video(void);
  3496.  
  3497.  
  3498.           Description
  3499.  
  3500.           The  save_initial_video  routine  initializes  the  Extended
  3501.           Library video  routines by  executing the settext80 routine,
  3502.           saving the cursor position  and type,  saving a  copy of the
  3503.           screen contents,  and clearing the screen.  When the program
  3504.           is finished running,  save_initial_video  will automatically
  3505.           restore the screen contents and restore the cursor.
  3506.  
  3507.  
  3508.           Return Value
  3509.  
  3510.           No value is returned.
  3511.  
  3512.  
  3513.           See Also
  3514.  
  3515.           settext80
  3516.  
  3517.  
  3518.           Example
  3519.  
  3520.           #include <stdio.h>
  3521.           #include <extlib.h>
  3522.  
  3523.           main()
  3524.           {
  3525.               save_initial_video();
  3526.               printcenter(13, 40, 
  3527.                   "This is a save_initial_video demo");
  3528.               waitkey();
  3529.               exit(0);
  3530.           }
  3531.  
  3532.           This program  demonstrates how  save_initial_video saves and
  3533.           restores the original screen contents.
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.                                                                     55
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.                                                             savescreen
  3549.  
  3550.           Summary
  3551.  
  3552.           #include <extlib.h>
  3553.  
  3554.           void savescreen(row1, col1, row2, col2, buffer);
  3555.           int row1, col1;               Upper-left corner  of the text
  3556.                                         window.
  3557.           int row2, col2;               Lower-right corner of the text
  3558.                                         window.
  3559.           char *buffer;                 Buffer pointer.
  3560.  
  3561.  
  3562.           Description
  3563.  
  3564.           The savescreen routine copies the text window defined by the
  3565.           points (row1,  col1) and  (row2, col2) into buffer.  Because
  3566.           each  of   the  text   window's  characters   consist  of  a
  3567.           character/attribute pair, the buffer must be ((row2 - row1 +
  3568.           1) * (col2 - col1 + 1) * 2)  bytes long.
  3569.  
  3570.  
  3571.           Return Value
  3572.  
  3573.           No value is returned.
  3574.  
  3575.  
  3576.           See Also
  3577.  
  3578.           restorescreen
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.                                                                     56
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.                                                             savescreen
  3608.  
  3609.           Example
  3610.  
  3611.           #include <stdio.h>
  3612.           #include <extlib.h>
  3613.  
  3614.           static char vbuff[4000];
  3615.  
  3616.           main()
  3617.           {
  3618.               settext80();
  3619.               savescreen(1, 1, 25, 80, vbuff);
  3620.               clearscreen(1, 1, 25, 80, 7);
  3621.               waitkey();
  3622.               restorescreen(1, 1, 25, 80, vbuff);
  3623.               waitkey();
  3624.               exit(0);
  3625.           }
  3626.  
  3627.           This program copies the screen into a buffer and then clears
  3628.           the screen.   After  waiting for a key, the program restores
  3629.           the previous screen display.
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.  
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.  
  3660.                                                                     57
  3661.  
  3662.  
  3663.  
  3664.  
  3665.  
  3666.                                                              setattrib
  3667.  
  3668.           Summary
  3669.  
  3670.           #include <extlib.h>
  3671.  
  3672.           void setattrib(row1, col1, row2, col2, attribute);
  3673.           int row1, col1;               Upper-left corner  of the text
  3674.                                         window.
  3675.           int row2, col2;               Lower-right corner of the text
  3676.                                         window.
  3677.           int attribute;                Text window attribute.
  3678.  
  3679.  
  3680.           Description
  3681.  
  3682.           The setattrib  routine saves  attribute for  the entire text
  3683.           window defined by the points (row1, col1) and (row2, col2).
  3684.  
  3685.  
  3686.           Return Value
  3687.  
  3688.           No value is returned.
  3689.  
  3690.  
  3691.           Example
  3692.  
  3693.           #include <stdio.h>
  3694.           #include <extlib.h>
  3695.  
  3696.           main()
  3697.           {
  3698.               save_initial_video();
  3699.               setattrib(1, 41, 25, 80, 0x70);
  3700.               waitkey();
  3701.               exit(0);
  3702.           }
  3703.  
  3704.           This  program  sets  the  right  half of the screen to black
  3705.           characters on a white background.
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.                                                                     58
  3720.  
  3721.  
  3722.  
  3723.  
  3724.  
  3725.                                                              setcurpos
  3726.  
  3727.           Summary
  3728.  
  3729.           #include <extlib.h>
  3730.  
  3731.           void setcurpos(row, col);
  3732.           int row, col;                 Cursor position.
  3733.  
  3734.  
  3735.           Description
  3736.  
  3737.           The setcurpos  routine  moves  the  cursor  to  the position
  3738.           defined by (row, col).
  3739.  
  3740.  
  3741.           Return Value
  3742.  
  3743.           No value is returned.
  3744.  
  3745.  
  3746.           Example
  3747.  
  3748.           #include <stdio.h>
  3749.           #include <extlib.h>
  3750.  
  3751.           main()
  3752.           {
  3753.               save_initial_video();
  3754.               setcurpos(13, 41);
  3755.               printf("Right half of the center line");
  3756.               waitkey();
  3757.               exit(0);
  3758.           }
  3759.  
  3760.           This program  moves the  cursor to  the center of the screen
  3761.           and prints a message.
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.                                                                     59
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.                                                              setcursor
  3785.  
  3786.           Summary
  3787.  
  3788.           #include <extlib.h>
  3789.  
  3790.           void setcursor(sline, eline);
  3791.           int sline;                    Cursor starting line.
  3792.           int eline;                    Cursor ending line.
  3793.  
  3794.  
  3795.           Description
  3796.  
  3797.           The setcursor routine sets the cursor starting line to sline
  3798.           and the cursor ending line to eline.
  3799.  
  3800.  
  3801.           Return Value
  3802.  
  3803.           No value is returned.
  3804.  
  3805.  
  3806.           Example
  3807.  
  3808.           #include <stdio.h>
  3809.           #include <extlib.h>
  3810.  
  3811.           main()
  3812.           {
  3813.               save_initial_video();
  3814.               setcursor(0, 7);
  3815.               waitkey();
  3816.               exit(0);
  3817.           }
  3818.  
  3819.           This  program  sets  the  cursor  starting line to 0 and the
  3820.           cursor ending line to 7.
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.                                                                     60
  3838.  
  3839.  
  3840.  
  3841.  
  3842.  
  3843.                                                                 setone
  3844.  
  3845.           Summary
  3846.  
  3847.           #include <extlib.h>
  3848.  
  3849.           void setone(row, col, attribute);
  3850.           int row, col;                 Screen position.
  3851.           int attribute;                Attribute.
  3852.  
  3853.  
  3854.           Description
  3855.  
  3856.           The setone  routine  sets  the  attribute  for  the position
  3857.           defined by (row, col) to attribute.
  3858.  
  3859.  
  3860.           Return Value
  3861.  
  3862.           No value is returned.
  3863.  
  3864.  
  3865.           Example
  3866.  
  3867.           #include <stdio.h>
  3868.           #include <extlib.h>
  3869.  
  3870.           main()
  3871.           {
  3872.               save_initial_video();
  3873.               setone(23, 2, 0x70);
  3874.               waitkey();
  3875.               exit(0);
  3876.           }
  3877.  
  3878.           This program sets position (23, 2) to a black character on a
  3879.           white background.
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.                                                                     61
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.                                                              settext80
  3903.  
  3904.           Summary
  3905.  
  3906.           #include <extlib.h>
  3907.  
  3908.           void settext80(void);
  3909.  
  3910.  
  3911.           Description
  3912.  
  3913.           The settext80 routine determines the display type (CGA, EGA,
  3914.           or MDA)  and sets  the video  mode to an 80 by 25 text mode.
  3915.           settext80 should always be  called before  using any  of the
  3916.           video functions in the Extended Library.
  3917.  
  3918.  
  3919.           Return Value
  3920.  
  3921.           No value is returned.
  3922.  
  3923.  
  3924.           See Also
  3925.  
  3926.           save_initial_video
  3927.  
  3928.  
  3929.           Example
  3930.  
  3931.           #include <stdio.h>
  3932.           #include <extlib.h>
  3933.  
  3934.           main()
  3935.           {
  3936.               settext80();
  3937.               clearscreen(1, 1, 25, 80, 7);
  3938.               waitkey();
  3939.               exit(0);
  3940.           }
  3941.  
  3942.           This program sets the video mode and clears the screen.
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.                                                                     62
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.                                                                  stick
  3962.  
  3963.           Summary
  3964.  
  3965.           #include <extlib.h>
  3966.  
  3967.           int stick(joystick);
  3968.           int joystick;                 Joystick to be read.
  3969.  
  3970.  
  3971.           Description
  3972.  
  3973.           The stick  routine reads  the joysticks, returning the value
  3974.           for the specified axis.  The  joystick parameter  can be one
  3975.           of the following manifest constants (defined in extlib.h):
  3976.  
  3977.                Constant                 Action
  3978.                _STICK_A_X               Reads the  x-axis for joystick
  3979.                                         A.
  3980.                _STICK_A_Y               Reads the  y-axis for joystick
  3981.                                         A.
  3982.                _STICK_B_X               Reads the  x-axis for joystick
  3983.                                         B.
  3984.                _STICK_B_Y               Reads the  y-axis for joystick
  3985.                                         B.
  3986.  
  3987.  
  3988.           Return Value
  3989.  
  3990.           Returns the value read for the indicated coordinate.
  3991.  
  3992.  
  3993.           See Also
  3994.  
  3995.           fire
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.                                                                     63
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.                                                                  stick
  4021.  
  4022.           Example
  4023.  
  4024.           #include <stdio.h>
  4025.           #include <extlib.h>
  4026.  
  4027.           main()
  4028.           {
  4029.               save_initial_video();
  4030.               while (!kbhit()) {
  4031.                   setcurpos(1, 1);
  4032.                   printf("%3d\n", stick(_STICK_A_X));
  4033.                   printf("%3d\n", stick(_STICK_A_Y));
  4034.                   printf("%3d\n", stick(_STICK_B_X));
  4035.                   printf("%3d\n", stick(_STICK_B_Y));
  4036.               }
  4037.               waitkey();
  4038.               exit(0);
  4039.           }
  4040.  
  4041.           This  program  reads  and  displays the four joystick values
  4042.           until a key is pressed.
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.                                                                     64
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.                                                           vertical_bar
  4080.  
  4081.           Summary
  4082.  
  4083.           #include <extlib.h>
  4084.  
  4085.           void vertical_bar(window, curpos, total, attribute);
  4086.           WINDOW *window;               Pointer   to    the   window's
  4087.                                         coordinates structure.
  4088.           int curpos;                   Current record.
  4089.           int total;                    Total number of records.
  4090.           int attribute;                Scroll bar attribute.
  4091.  
  4092.  
  4093.           Description
  4094.  
  4095.           The vertical_bar  routine displays  a vertical scroll bar at
  4096.           the right  hand  side  of  a  window  whose  coordinates are
  4097.           pointed to  by window.   The current position in the file is
  4098.           derived by dividing  curpos  by  total.    Additionally, the
  4099.           scroll bar is displayed with an attribute of attribute.
  4100.  
  4101.  
  4102.           Return Value
  4103.  
  4104.           No value is returned.
  4105.  
  4106.  
  4107.           See Also
  4108.  
  4109.           horizontal_bar and open_window.
  4110.  
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.                                                                     65
  4133.  
  4134.  
  4135.  
  4136.  
  4137.  
  4138.                                                           vertical_bar
  4139.  
  4140.           Example
  4141.  
  4142.           #include <stdio.h>
  4143.           #include <extlib.h>
  4144.  
  4145.           main()
  4146.           {
  4147.               WINDOW *window;
  4148.  
  4149.               save_initial_video();
  4150.               window = open_window(1, 30, 10, 70, _DRAW, 7,
  4151.                   _SINGLE_LINE, 7);
  4152.               vertical_bar(window, 0, 100, 7);
  4153.               waitkey();
  4154.               vertical_bar(window, 50, 100, 7);
  4155.               waitkey();
  4156.               vertical_bar(window, 100, 100, 7);
  4157.               waitkey();
  4158.               exit(0);
  4159.           }
  4160.  
  4161.           This  program  opens  a  window and displays scroll bars for
  4162.           various points in a file.
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.  
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.                                                                     66
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.                                                                waitkey
  4198.  
  4199.           Summary
  4200.  
  4201.           #include <extlib.h>
  4202.  
  4203.           int waitkey(void);
  4204.  
  4205.  
  4206.           Description
  4207.  
  4208.           The waitkey routine waits for a key to be pressed.
  4209.  
  4210.  
  4211.           Return Value
  4212.  
  4213.           The returned value is the ASCII  code for  the key  that was
  4214.           pressed.   Extended keys return a value of their scan code +
  4215.           256.
  4216.  
  4217.  
  4218.           Example
  4219.  
  4220.           #include <stdio.h>
  4221.           #include <extlib.h>
  4222.  
  4223.           main()
  4224.           {
  4225.               int key;
  4226.  
  4227.               save_initial_video();
  4228.               while (TRUE) {
  4229.                   if ((key = waitkey()) == 27)
  4230.                       exit(0);
  4231.                   printf("%d\n", key);
  4232.               }
  4233.           }
  4234.  
  4235.           This program continuously waits for a key to  be pressed and
  4236.           displays the key's value until ESC is pressed.
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.                                                                     67
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.                                                             Appendix A
  4257.  
  4258.                 Appendix A - Using Extended Library With QuickC
  4259.  
  4260.  
  4261.           Constructing a Quick Library
  4262.  
  4263.           The first  step in  using Extended Library with QuickC is to
  4264.           construct  a  quick  library   with  the   Extended  Library
  4265.           routines.     The  following   command  will  construct  the
  4266.           necessary quick library:
  4267.  
  4268.                qlib /n extlib.qlb /l mextlibe.lib /s extlib.c
  4269.  
  4270.           The above command instructs the qlib to search  extlib.c for
  4271.           any C  run-time routines  that aren't  a part  of the QuickC
  4272.           core library.  Therefore,  the linker  will extract _harderr
  4273.           and  _hardresume  from  mlibce.lib.   These two routines are
  4274.           necessary to use error_handler in your programs.   Any other
  4275.           routines that  you wish extracted can easily be specified by
  4276.           adding their names to extlib.c.
  4277.  
  4278.  
  4279.           The QuickC Windowing Environment
  4280.  
  4281.           Because QuickC uses its  own  windowing  environment,  it is
  4282.           necessary to add a printf(" "); statement before calling any
  4283.           of the Extended Library video routines.  Failure  to add the
  4284.           printf(" "); statement will cause unpredictable results when
  4285.           the program is run from within the QuickC  environment.  The
  4286.           following is an example:
  4287.  
  4288.           #include <stdio.h>
  4289.           #include <extlib.h>
  4290.  
  4291.           main()
  4292.           {
  4293.               save_initial_video();
  4294.               setattrib(1, 1, 13, 40, 0x70);
  4295.               waitkey();
  4296.           }
  4297.  
  4298.  
  4299.  
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.  
  4306.  
  4307.  
  4308.  
  4309.                                                                     68
  4310.  
  4311.  
  4312.  
  4313.  
  4314.  
  4315.                                                             Appendix A
  4316.  
  4317.           Should Be:
  4318.  
  4319.           #include <stdio.h>
  4320.           #include <extlib.h>
  4321.  
  4322.           main()
  4323.           {
  4324.               printf(" ");
  4325.               save_initial_video();
  4326.               setattrib(1, 1, 13, 40, 0x70);
  4327.               waitkey();
  4328.           }
  4329.  
  4330.           By adding the printf(" "); statement to the program,  QuickC
  4331.           will release  control  of  the  video  display  over  to the
  4332.           program.    Thus,  proper  execution  will result.  Once the
  4333.           program has been fully  debugged and  will only  be run from
  4334.           outside  of   the  QuickC   environment,  the  printf("  ");
  4335.           statement can be safely removed from the program.
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.                                                                     69
  4369.  
  4370.  
  4371.  
  4372.  
  4373.  
  4374.                                                             Appendix B
  4375.  
  4376.                         Appendix B - Source Code Files
  4377.  
  4378.           The following is a list of the Extended  Library source code
  4379.           files  (These  files  are  not  included  on  the  shareware
  4380.           distribution disk.   They  are only  available to registered
  4381.           owners.):
  4382.  
  4383.                File                     Routines
  4384.                dinput.c                 inputdollars
  4385.                error.c                  display_error
  4386.                                         error_handler
  4387.                games.asm                fire
  4388.                                         stick
  4389.                menubar                  display_menu_bar
  4390.                                         menu_bar
  4391.                misc.c                   waitkey
  4392.                minimenu.c               mini_menu
  4393.                minput.c                 inputfields
  4394.                                         printdelimit
  4395.                                         printfields
  4396.                                         printheads
  4397.                ninput.c                 inputnumber
  4398.                popup.c                  popup
  4399.                pulldown.c               pulldown
  4400.                                         pulldown_bar
  4401.                screen.c                 printcenter
  4402.                                         save_initial_video
  4403.                                         setcursor
  4404.                scroll.c                 horizontal_bar
  4405.                                         scroll_window
  4406.                                         vertical_bar
  4407.                sinput.c                 inputstring
  4408.                video.asm                clearone
  4409.                                         clearscreen
  4410.                                         cursoroff
  4411.                                         cursoron
  4412.                                         drawbox
  4413.                                         fillone
  4414.                                         fillscreen
  4415.                                         getcurpos
  4416.                                         printone
  4417.                                         printstring
  4418.                                         restorescreen
  4419.                                         savescreen
  4420.                                         setattrib
  4421.                                         setcurpos
  4422.                                         setone
  4423.                                         settext80
  4424.  
  4425.  
  4426.  
  4427.                                                                     70
  4428.  
  4429.  
  4430.  
  4431.  
  4432.  
  4433.                                                             Appendix B
  4434.  
  4435.                window.c                 close_window
  4436.                                         draw_window
  4437.                                         open_window
  4438.  
  4439.  
  4440.  
  4441.  
  4442.  
  4443.  
  4444.  
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.  
  4459.  
  4460.  
  4461.  
  4462.  
  4463.  
  4464.  
  4465.  
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.                                                                     71
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.                                                             Appendix C
  4493.  
  4494.                            Appendix C - Registration
  4495.  
  4496.           Registration licenses  you to  use Extended Library 1.0, and
  4497.           all future 1.x updates.   Any  unregistered  use  other than
  4498.           trial use  to determine if Extended Library meets your needs
  4499.           is a violation of our license agreement and is forbidden.
  4500.  
  4501.           Single user registration is  available for  $20.00 per copy.
  4502.           Registered users  will be  sent the  most current version of
  4503.           Extended Library.  This includes all  eight versions  of the
  4504.           library and  the complete  source code  for the library.  If
  4505.           enough  people  register,  a   printed  manual   may  become
  4506.           available at  some future  date.   This manual, if produced,
  4507.           will also be provided to  registered  owners  at  no charge.
  4508.           Registration also entitles you to free telephone support and
  4509.           discounts on future versions of Extended Library.
  4510.  
  4511.           The Extended Library license authorizes the use of  one copy
  4512.           of Extended  Library on  one machine at a time.  If you have
  4513.           multiple computers, either standalone,  networked, or multi-
  4514.           user, you  need to register one copy of Extended library for
  4515.           each workstation on which it will be used.
  4516.  
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.                                                                     72
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.                                     Invoice
  4552.  
  4553.  
  4554.                     Maine Data and Financial Systems, Inc.
  4555.                                 HCR 79 Box 103
  4556.                                Orland, ME 04472
  4557.  
  4558.                                 (207) 469-7027
  4559.  
  4560.  
  4561.           Quantity  Description                                 Amount
  4562.  
  4563.           _____     Extended Library 1.0 Registration @ $20.00  ______
  4564.  
  4565.  
  4566.                     Registration is for each computer or 
  4567.                     workstation on which Extended Library
  4568.                     will be used.
  4569.  
  4570.                                                   Subtotal      ______
  4571.  
  4572.                          Maine residents add 5% sales tax       ______
  4573.  
  4574.                                                      Total      ______
  4575.  
  4576.  
  4577.                Name: _________________________________________________
  4578.  
  4579.             Company: _________________________________________________
  4580.  
  4581.             Address: _________________________________________________
  4582.  
  4583.                      _________________________________________________
  4584.  
  4585.                      _________________________________________________
  4586.  
  4587.           Day Phone: ____________________ Eve: _______________________
  4588.  
  4589.  
  4590.                            THANK YOU FOR YOUR ORDER
  4591.